package cn.cvs.utils;

import java.util.List;

/**
 * 分页工具类
 * @param <T>
 */
public class Page<T> {
    private int currentPageNo;;        //当前页码
    private int totalPageCount ;    //总页数
    private int pageSize =Constants.pageSize;            //每页展示记录数
    private int totalCount ;          //总数据量
    private List<T> list;        //每页数据集合


    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
    }

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {

        if (totalCount>0){
            this.totalCount = totalCount;
            //求总页数
            this.totalPageCount = (totalCount%pageSize)==0 ? (totalCount/pageSize) :((totalCount/pageSize)+1);
        }
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

}
